package FanShe.danli;

//懒汉式 枷锁
public class Lhan {
    private Lhan(){

    }

    private volatile static Lhan lhan;
//双重检测锁
    public static Lhan getInstance(){
        if (lhan==null){
            synchronized (Lhan.class){
                if (lhan==null) {//不是原子性操作
                    lhan = new Lhan();
                }

            }
        }
        return lhan;
    }
}
